#include<iostream>
#include"shm.hpp"

using namespace std;

int main()
{
    //1.processb 获取shmid
    int shmid = Getshmid();
    if(shmid < 0)
    {
        perror("getshmid error\n");
        exit(3);
    }

    //2.processb挂起共享内存区域
    char* shmaddress = (char*)shmat(shmid, nullptr, 0);

    //3.开始通信 processb发送数据（读）
    while(true)
    {
        
        cout << "please Enter@ ";
        fgets(shmaddress, 4096, stdin);
    }

    //4.将共享内存拿下来
    shmdt(shmaddress);  

    return 0;
}